<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Code')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-code" data-rule="code_check" data-rule-code_check="[/^[a-zA-Z][a-zA-Z0-9_]*$/,'请以字母开头']" class="form-control" name="row[code]" type="text" value="{$row.code|htmlentities}">
            <span class="help-block">作用等同ID,可用于在业务代码中调用此模板发送消息</span>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Robot_ids')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-robot_ids" data-rule="required" data-source="vbot/robot/index" data-multiple="true" class="form-control selectpage" name="row[robot_ids]" type="text" value="{$row.robot_ids|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Typelist')}:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <select  id="c-typelist" data-rule="required" class="form-control selectpicker" name="row[typelist]">
                {foreach name="typelistList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.typelist"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>

    <div class="form-group msg_group msg_content">
        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content" placeholder="支持使用变量,格式：${变量名}" name="row[content]" class="form-control" rows="5">{$row.content|htmlentities}</textarea>
            <p class="help-block msg_group markdown_help" style="display: none;">请输入markdown格式的内容 <a id="show_grammar" href="javascript:void();">显示语法</a></p>
            <span class="help-block msg_group markdown_grammar" style="display: none;">
                目前只支持这些元素<br />
                标题：#到######<br />
                链接：[锚](url)<br />
                单行代码：`code`<br />引用：><br />
                加粗：**<br />
                字体颜色：<pre><xmp><font color="info">绿色</font></xmp>color可设置的值有 info:绿色、comment:灰色、warning:橙红色</pre>
            </span>
        </div>
    </div>

    <div class="form-group msg_group msg_picurl_image">
        <label class="control-label col-xs-12 col-sm-2">{:__('Picurl_image')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-picurl_image" class="form-control" size="50" name="row[picurl_image]" type="text" value="{$row.picurl_image|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-picurl_image" class="btn btn-danger plupload" data-input-id="c-picurl_image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-picurl_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-picurl_image" class="btn btn-primary fachoose" data-input-id="c-picurl_image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-picurl_image"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-picurl_image"></ul>
            <span class="help-block">超过2M的图片无法发送，支持JPG、PNG格式</span>
        </div>
    </div>

    <div class="form-group msg_group msg_news">
        <label class="control-label col-xs-12 col-sm-2">{:__('News')}:</label>
        <div class="col-xs-12 col-sm-8">
            <dl class="fieldlist" data-name="row[news]" data-template="newstpl">
                <dd>
                    <ins class="news_ins">标题</ins>
                    <ins class="news_ins">链接URL</ins>
                    <ins class="news_ins">链接图片URL</ins>
                </dd>
                <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
                <textarea name="row[news]" class="form-control hide" cols="30" rows="5">{$row.news}</textarea>
            </dl>
            <!--定义模板-->
            <div class="hide" id="newstpl">
                <dd class="form-inline">
                    <input type="text" name="row[<%=name%>][<%=index%>][title]" class="form-control news_input" value="<%=row['title']%>" size="10"> 
                    <input type="text" name="row[<%=name%>][<%=index%>][url]" class="form-control news_input" value="<%=row['url']%>" size="30"> 
                    <input type="text" name="row[<%=name%>][<%=index%>][picurl]" class="form-control news_input" value="<%=row['picurl']%>" size="30"> 
                    <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
                </dd>
            </div>
            <span class="help-block">标题支持使用变量,当只有一条图文时,才会显示消息内容,最多八条图文</span>
        </div>
    </div>
    
    <div class="form-group msg_group msg_at">
        <label class="control-label col-xs-12 col-sm-2">{:__('At_mobiles')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-at_mobiles" data-source="user/user/index" data-multiple="true" data-primary-key="mobile" data-field="mobile" class="form-control selectpage" name="row[at_mobiles]" type="text" value="{$row.at_mobiles|htmlentities}">
        </div>
    </div>
    <div class="form-group msg_group msg_at">
        <label class="control-label col-xs-12 col-sm-2">{:__('Is_atall')}:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <select  id="c-is_atall" class="form-control selectpicker" name="row[is_atall]">
                {foreach name="isAtallList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.is_atall"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Openswitch')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <input  id="c-openswitch" name="row[openswitch]" type="hidden" value="{$row.openswitch}">
            <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-openswitch" data-yes="1" data-no="0" >
                <i class="fa fa-toggle-on text-success {eq name="$row.openswitch" value="0"}fa-flip-horizontal text-gray{/eq} fa-2x"></i>
            </a>
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<style type="text/css">
    .fieldlist dd input:nth-child(2),.fieldlist dd ins:nth-child(2) {
        width: 58%;
    }
    .fieldlist dd input:first-child,.fieldlist dd ins:first-child {
        width: 25%;
    }

    .fieldlist dd input:nth-child(2),.fieldlist dd ins:nth-child(2) {
        width: 58%;
    }
    .fieldlist dd .news_input,.fieldlist .news_ins{
        width: 27% !important;
    }
</style>